I want to add a user to a role when a checkbox on the profile has been checked. It's printing the dpm() message but not adding the user to the role. What am I missing.
function mycustom_form_user_profile_form_alter(&$form, $form_state, $form_id) {
$form['#validate'][] = '_user_profile_validate';
...
}
function _user_profile_validate(&$form, &$form_state) {
if (($form_state['values']['field_restricted']['und'][0]['value']) == 1) {
dpm('role added');
global $user;
user_multiple_role_edit(array($user->uid), 'add_role', 6);
}
}
user_multiple_role_edit()
function is actually executed and all the data you're passing to it is correct?